package com.itheim.controller;

import com.itheim.pojo.Result;
import com.itheim.pojo.clazzOption;
import com.itheim.pojo.jobOption;
import com.itheim.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/report")
public class ReportController {

    @Autowired
    private ReportService reportService;

    //5.2 员工职位人数统计
    @GetMapping("/empJobData")
    public Result getEmpJobData() {
        log.info("获取员工职位人数");
        jobOption jobOption = reportService.getEmpJobData();
        return Result.success(jobOption);
    }

    //5.1 员工性别统计
    @GetMapping("/empGenderData")
    public Result getEmpGenderData() {
        log.info("获取员工性别人数");
        List<Map<String, Object>> genderList=reportService.getEmpGenderData();
        return Result.success(genderList);
    }

    //5.4 班级人数统计
    @GetMapping("/studentCountData")
    public Result getStudentCountData() {
        log.info("获取班级人数");
        clazzOption clazzOption = reportService.getStudentCountData();
        return Result.success(clazzOption);
    }

    //5.3 学员学历统计
    @GetMapping("/studentDegreeData")
    public Result getStudentDegreeData() {
        log.info("获取学员学历");
        List<Map<String, Object>> degreeList=reportService.getStudentDegreeData();
        return Result.success(degreeList);
    }
}
